﻿@model ProjectManagement.Domain.Entities.Role
@{
	ViewBag.Title = "EditRole";
	Layout = null;
}

<h2>编辑角色信息</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>


@using (Html.BeginForm("EditRole", "RoleManage", FormMethod.Post))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>角色信息</legend>

        @Html.HiddenFor(model => model.ID)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>
		<div >
			<h2>权限列表</h2>
			<hr />
			@{
				foreach (var item in ViewBag.AllPermission)
				{
					if ((ViewBag.Permission).Count> 0)
					{
						if ((ViewBag.Permission).Contains(item))
						{
							<input name="per" type="checkbox" checked="checked" value="@item.ID" />@item.Name
						}
						else
						{
							<input name="per" type="checkbox" value="@item.ID" />@item.Name
						}
					}
					else
					{
						<input name="per" type="checkbox" value="@item.ID" />@item.Name
					}
				}
				
			}
		</div>
		<hr />
        <p>
            <input type="submit" value="保存" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("返回列表", "RoleList")
</div>
